package ocean.chinacraft.common.world.item.tool.base;

import ocean.chinacraft.common.ModItems;
import net.minecraft.item.IItemTier;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.LazyValue;

import javax.annotation.Nonnull;
import java.util.function.Supplier;

/**
 * 物品Tier
 *
 * @author zhang
 * @since 2021/11/19
 */
public enum ModItemTier implements IItemTier {

    /**
     * 青铜大刀
     */
    BIG_BRONZE_SWORD(2, 500, 6.0F, 2.5F, 10, () -> Ingredient.of(ModItems.BIG_BRONZE_SWORD.get())),

    /**
     * 狼牙棒
     */
    MACE(2, 500, 6.0F, 2F, 10, () -> Ingredient.of(ModItems.BIG_BRONZE_SWORD.get())),

    /**
     * 九曲镋
     */
    JIU_QU_TANG(2, 251, 6.0F, 2F, 10, () -> Ingredient.of(ModItems.JIU_QU_TANG.get())),

    /**
     * 炎龙巨刀
     */
    YAN_LONG_BIG_KNIFE(2, 3000, 6.0F, 6F, 10, () -> Ingredient.of(ModItems.YAN_LONG_BIG_KNIFE.get())),

    /**
     * 青铜大刀 - 翡翠
     */
    BRONZE_SWORD_JADE(2, 2000, 6.0F, 2.5F, 10, () -> Ingredient.of(ModItems.BRONZE_SWORD_JADE.get())),

    /**
     * 青铜大刀 - 碧玉
     */
    BRONZE_SWORD_JASPER(2, 2000, 6.0F, 2.5F, 10, () -> Ingredient.of(ModItems.BRONZE_SWORD_JASPER.get())),

    /**
     * 青铜大刀 - 芙蓉玉
     */
    BRONZE_SWORD_HIBISCUS(2, 2000, 6.0F, 2.5F, 10, () -> Ingredient.of(ModItems.BRONZE_SWORD_HIBISCUS.get())),

    /**
     * 青铜大刀 - 紫玉
     */
    BRONZE_SWORD_PURPLE(2, 2000, 6.0F, 2.5F, 10, () -> Ingredient.of(ModItems.BRONZE_SWORD_PURPLE.get())),

    /**
     * 青铜稿子
     */
    BRONZE_PICKAXE(2, 200, 6.0F, 2.0F, 10, () -> Ingredient.of(ModItems.BRONZE_PICKAXE.get())),

    /**
     * 青铜斧头
     */
    BRONZE_AXE(2, 251, 6.0F, 2.0F, 10, () -> Ingredient.of(ModItems.BRONZE_AXE.get())),

    /**
     * 青铜铲子
     */
    BRONZE_SHOVEL(2, 200, 6.0F, 2.0F, 10, () -> Ingredient.of(ModItems.BRONZE_SHOVEL.get())),

    /**
     * 青铜锄头
     */
    BRONZE_HOE(2, 251, 6.0F, 2.0F, 10, () -> Ingredient.of(ModItems.BRONZE_HOE.get()))

    ;

    private final int level;
    private final int maxUses;
    private final float speed;
    private final float attackDamageBonus;
    private final int enchantmentValue;
    private final LazyValue<Ingredient> repairIngredient;

    ModItemTier(int level, int maxUses, float speed, float attackDamageBonus, int enchantmentValue,
                Supplier<Ingredient> repairIngredient) {
        this.level = level;
        this.maxUses = maxUses;
        this.speed = speed;
        this.attackDamageBonus = attackDamageBonus;
        this.enchantmentValue = enchantmentValue;
        this.repairIngredient = new LazyValue<>(repairIngredient);
    }

    @Override
    public int getUses() {
        return maxUses;
    }

    @Override
    public float getSpeed() {
        return speed;
    }

    @Override
    public float getAttackDamageBonus() {
        return attackDamageBonus;
    }

    @Override
    public int getLevel() {
        return level;
    }

    @Override
    public int getEnchantmentValue() {
        return enchantmentValue;
    }

    @Nonnull
    @Override
    public Ingredient getRepairIngredient() {
        return repairIngredient.get();
    }
}
